﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>

<?php
//Spiel bestätigen

 ini_set( 'display_errors', false );
 // error_reporting( E_ALL );

include("inc/joomlaInt.php");
include("inc/inc_configuration.php");

if ($jUser==0)
{
	echo "Bitte zuerst einloggen!";
}
else
{
	$query = "	SELECT 	m.id AS id,
						t1.name AS hN,
						t2.name AS gN,
						c1.userId AS hU,
						c2.userId AS gU,
						m.homeG AS hG,
						m.guestG AS gG,
						b.homeB AS hB,
						b.guestB AS gB
				FROM 	$tbl_matches m, 
						$tbl_teams t1, 
						$tbl_teams t2, 
						$tbl_bestaetigung b, 
						$tbl_combinations c1, 
						$tbl_combinations c2
				WHERE
					m.free=2 AND
					m.id=b.matchId AND
					m.homeT=t1.id AND
					m.guestT=t2.id AND
					m.homeC=c1.id AND
					m.guestC=c2.id
					";

	$q = mysql_query($query);

	$c = mySQL_num_rows($q);

	if ($c>0)
	{

		while ($i = mysql_fetch_object($q))
		{
			$hU=$i->hU;
			$gU=$i->gU;
			$hB=$i->hB;
			$gB=$i->gB;
			$b=0;
			
			if (($hU==$jUser) AND ($hB!=1))
			{
				$b=1;
			}
			else
			{
				if (($gU==$jUser) AND ($gB!=1))
				{
					$b=2;
				}
			}
			
			if ($b>0)
			{
				$hN=$i->hN;
				$gN=$i->gN;
				$hG=$i->hG;
				$gG=$i->gG;
				$matchId=$i->id;
		
				$_GET["matchID"] = $matchId;
				$_GET["type"] = 1;
				
				
				
				include("spielbericht.php");
				
				echo "	<br><table>
						<tr>
							<th colspan='2'></th>
						</tr>
						<tr>
							<td width='50%'>
								<center>
									<form action='spiel_bestaetigen_v.php?matchId=$matchId' method='post'>
										<input type='submit' value='Bestätigen' class='button eintragen'>
									</form>
								</center>
						</td>";
				echo "	<td width='50%'>
						<center>
						<form action='spiel_bearbeiten.php?matchId=$matchId' method='post'>
							<input type='submit' value='Bearbeiten' class='button bearbeiten'>
						</form>
						</center>
						</td>
						</tr>
						<tr>
							<td colspan='2'>
								<center><a href='lima.php' class='button zurueck'>Zurück</a></center>
							</td>
						</tr>
						<tr>
							<th colspan='2'></th>
						</tr>
						</table>";
							
			}
		}
	}	
	else
	{
		echo "Kein Spiel zum Bestätigen gefunden!";
		echo '<center><br><br><a href="lima.php" class="button zurueck">Zurück</a></center>';
	}







	//echo 'Sie werden weitergeleitet... <meta http-equiv="refresh" content="3; URL=lima.php">   ';


}
?>

</body>
</html>